module kinds
implicit none
type Mytype
  integer, allocatable, dimension(:, :) :: arr
end type Mytype
end module kinds

program main
use kinds
implicit none
type(Mytype) :: myvar, myvar1
integer, allocatable, dimension(:,:) :: myarr
allocate( myvar%arr(2,2) )
allocate( myvar1%arr(2,2) )
allocate( myarr(2,3) )
myvar%arr(1,1) = 1
myvar%arr(1,2) = 3
myvar%arr(2,1) = 2
myvar%arr(2,2) = 4
call func(myvar, myvar1)
print *, myvar%arr
print *, myvar1%arr
deallocate(myvar%arr)
deallocate(myvar1%arr)

end program main

subroutine func( myvar, myvar1)
  use kinds
  implicit none
  type(Mytype) :: myvar, myvar1
  integer:: i, j
  myvar1%arr = myvar%arr
  myvar1%arr(1,1)=5
end subroutine func
